import {getParentCateList} from "../service/cateApi";

export default {
  LoginMutation(state, entity) {
    state.data = entity.data
    state.status = entity.meta.status
  },
  MenuListMutation(state, entity) {
    state.menu_list = entity
  },
  UserListMutation(state, entity) {
    state.users_list = entity.users
    state.users_total = entity.total
    state.user_pagenum = entity.pagenum
  },
  UserMutation(state, entity) {
    state.user = entity.data
    state.user_state = entity.meta.status
  },
  RightsListMutation(state, entity) {
    state.right_list = entity.data
    state.right_state = entity.meta.status
    state.right_total = entity.total
  },
  RolesListMutation(state, entity) {
    state.roles_list = entity.data
    state.roles_state = entity.meta.status
    state.roles_total = entity.total
  },
  RolesMutation(state, entity) {
    state.roles = entity.data
    state.roles_state = entity.meta.status
  },
  AllotRightsMutation(state, entity) {
    state.allot_right = entity.data
    state.allot_right_state = entity.meta.status
  },
  SaveRoleInfo(state, entity) {
    state.save_info = entity.data
    state.save_state = entity.meta.status
  },
  CateListMutation(state, entity) {
    state.cate_list = entity.data.result
    state.cate_list_state = entity.meta.status
    state.cate_total = entity.data.total
  },
  ParentCateListMutation(state, entity) {
    state.parent_cate_list = entity.data
    state.parent_cate_state = entity.meta.status
  },
  CateMutation(state, entity) {
    state.cate = entity.data
    state.cate_state = entity.meta.status
  },
  ParamsCateListMutation(state, entity) {
    state.params_cate_list = entity.data
    state.params_cate_list_state = entity.meta.status
  },
  ParamsMutation(state, entity) {
    state.params = entity.data
    state.params_state = entity.meta.status
  },
  GoodsListMutation(state, entity) {
    state.goods_list = entity.data
    state.page_num = parseInt(entity.data.pagenum)
    state.goods_state = entity.meta.status
    state.total = entity.data.total
  },
  GoodsMutation(state, entity) {
    state.goods = entity.data
    state.goods_add_state = entity.meta.status
  },
  OrdersListMutation(state, entity) {
    state.orders_list = entity.data
    state.page_num = parseInt(entity.data.pagenum)
    state.orders_state = entity.meta.status
    state.total = entity.data.total
  },
  OrderMutation(state, entity) {
    state.order = entity.data
    state.orders_state = entity.meta.status
  },
  WLMutation(state, entity) {
    state.wuliu = entity.data
    state.wl_state = entity.meta.status
  },
  ReportMutation(state, entity) {
    state.report = entity.data
  }
}
